#include<iostream>
#include<string>
using namespace std;

class Solution {
public:
    int StrToInt(string str) {
        int ret = 0;
        int flag = 1;
        for (int i = 0; i < str.size(); i++)
        {
            if (i == 0)
            {

                if (str[0] == '-')
                    flag = -1;
                else if (str[0] == '+')
                    flag = 1;
                else if (str[0] < '1' || str[0] > '9')
                    return 0;
                else
                {
                    ret += str[i] - '0';
                    cout << ret;
                }
            }
            else
            {
                if (str[i] >= '0' && str[i] <= '9')
                    ret = ret * 10 + str[i] - '0';
                if (str[i] < '0' && str[i] > '9')
                    return 0;
            }
        }
        return ret * flag;
    }
};

int main()
{
    Solution s;
    cout << s.StrToInt("##");
}